package com.tiniplanet.webgate.aspects.logging;

import org.apache.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class AspectLogger {

	private static final Logger _log = Logger.getLogger("webgate-perf");

	@Around("within(com.tiniplanet.webgate..*)")
	public Object doLogging(ProceedingJoinPoint joinPoint) throws Throwable {
		long start = System.currentTimeMillis();
		Object obj = joinPoint.proceed();

		long end = System.currentTimeMillis();
		String method = joinPoint.getSignature().toShortString();
		_log.info(method + " " + (end - start));
		return obj;
	}
}
